import Mock from 'mockjs'
const Random = Mock.Random
const Members = function () {
  let name = Random.cname()
  let id = Random.id()
  let obj = Mock.mock({
    'array|2-8': [{'name': name, 'id': id}]
  })
  return obj.array
  // let arr = arr1.concat(arr2)
  // return arr
}
Random.extend({
  types: function(data) {
    let types = ['抓捕', '搜查', '审讯', '拷问', '卧底', '起诉', '处决', '释放']
    return this.pick(types)
  },
  status: function(data) {
    let status = [ '接警', '受理', '立案登记', '侦查终结', '移交起诉' ]
    return this.pick(status) 
  },
  members: function() {
    return Members()
  }
})
const COL = [
  {prop: 'groupName', label: '小组名称'},
  {prop: 'taskName', label: '任务名称'},
  {prop: 'deadLine', label: '截至时间'},
  {prop: 'status', label: '任务状态'},
  {prop: 'type', label: '任务类型'},
  {prop: 'desc', label: '任务内容'},
  {prop: 'rule', label: '任务要求'}
  // {prop: 'members', label: '任务成员'}
]

export function getDetectiveTasksMock(Mock, url, query) {
  console.log('mockquery', query)
  return Mock.mock({
    code: 0,
    msg: '',
    data: {
      page: `${query.page}`,
      limit: `${query.limit}`,
      total: 100,
      [`list|${query.limit}`]: [
        {
          'groupName|3-6': '@cword',
          'taskName|3-12': '@cword',
          'deadLine': '@date',
          'status': '@status',
          'type': '@types',
          'desc|5-30': '@cword',
          'rule|5-30': '@cword',
          'members': '@members'
        }
      ],
      colData: COL
    } 
  }) 
} 